import request from '@/axios/axios.js'

//设备维修工单-申请维修
export function addWorkOrder(data,params) {
    return request({
        url: '/dms/workOrder/add',
        method: 'post',
        data,
        params
    })
}
//输入设备流水号获取设备信息
export function getDeviceListinfo(params) {
    return request({
        url: '/dms/dmsDevice/deviceList',
        method: 'get',
        params
    })
}
//保养任务-数量统计
export function getlistNum(data) {
    return request({
        url: '/dms/mobile/maintainTask/listNum',
        method: 'post',
        data
    })
}
//保养-设备保养方式
export function getlistType(data,params) {
    return request({
        url: '/dms/mobile/maintainTask/deviceMaintainTypes',
        method: 'post',
        data,
        params
    })
}
//保养设备列表
export function getDeviceList(data) {
    return request({
        url: '/dms/devSpotCheckTask/querySpotCheckTaskList',
        method: 'post',
        data,
    })
}
//获取保养项目
export function getListitems(params) {
    return request({
        url: '/dms/devSpotCheckTask/getTaskDetailById',
        method: 'post',
        params
    })
}
//确认保养
export function enterMaintenance(data,url) {
    return request({
        url,
        method: 'post',
        data
    })
}
//结案
export function finishCase(data) {
    return request({
        url: '/dms/mobile/maintainTask/finish',
        method: 'post',
        data
    })
}
//获取备品备件
export function getDatatools(params) {
    return request({
        url: '/dms/mobile/maintainTask/queryByItemId',
        method: 'get',
        params
    })
}
//保存备品备件
export function saveMaintence(data,str) {
    const obj = {
        url: '/dms/mobile/maintainTask/saveByItemId',
        method: 'post',
        data
    }
    if (str === 'edit'){
        obj.url = '/dms/mobile/maintainTask/editByItemId'
    }
    return request(obj)
}
//添加编辑工具
export function saveTool(data,str) {
    const obj = {
        url: '/dms/mobile/maintainTask/addTool',
        method: 'post',
        data
    }
    if (str === 'edit'){
        obj.url = '/dms/mobile/maintainTask/editTool'
    }
    return request(obj)
}
//编辑备品备件
export function editMaintence(data,params) {
    return request({
        url: '/dms/mobile/maintainTask/editByItemId',
        method: 'post',
        data,
        params
    })
}

//查询备件编号
export function checkMaterielNo(params) {
    return request({
        url: '/dms/applyUse/queryBymaterielNo',
        method: 'get',
        params
    })
}
//删除备品备件
export function deleMaterielNo(params) {
    return request({
        url: '/dms/mobile/maintainTask/deleteById',
        method: 'get',
        params
    })
}
//删除工具
export function deleToolNo(params) {
    return request({
        url: '/dms/mobile/maintainTask/delTool',
        method: 'get',
        params
    })
}
//上传
export function fileUpload(formData,config) {
    return request({
        url: '/fileServer/upload',
        method: 'post',
        data:formData,
        config
    })
}

// 添加附件
export function addfileUpload(data) {
    return request({
        url: '/dms/dcmAttachment/add',
        method: 'post',
        data
    })
}
//附件删除
export function delfileUpload(params) {
    return request({
        url: '/dms/dcmAttachment/delete',
        method: 'delete',
        params
    })
}
